package cn.tedu;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @author liyuehui
 * @time 2024/7/8 19:01
 */
public class StreamDemo {
    public static void main(String[] args) {
        /*List<String> list = Arrays.asList("小鸡", "小鸭子", "小猫", "小狗");*/
        /*list.stream()
                .filter(s -> s.startsWith("小"))
                .filter(s -> s.length() == 2)
                .forEach(System.out::println);*/
        /*HashMap<Object, Object> oh = new HashMap<>();
        Set<Map.Entry<Object, Object>> entries = oh.entrySet();
        entries.stream();*/
        ArrayList<Student> list = new ArrayList<>();
        list.add(new Student("小明", 18, "男"));
        list.add(new Student("小红", 19, "女"));
        list.add(new Student("小刚", 20, "男"));
        list.add(new Student("小李", 21, "男"));
        List<String> collect = list.stream()
                .map(Student::getName)
                .collect(Collectors.toList());
        System.out.println(collect);
    }
}
